-module(my_net_sup).
-behaviour(supervisor).
-include("common.hrl").

-export([start_link/0,init/1,start/0,add/1]).

%%--------------------------------------------------------------------
start_link() -> io:format("9999999999~n"),
    supervisor:start_link({local, ?MODULE}, ?MODULE, []).

start() ->
    ?MODULE:start_link().

init([]) ->
    Children = {my_net, {my_net, start_link, []}, temporary, 2000, worker, [my_net]},
    RestartStrategy = {simple_one_for_one, 10, 10},
    {ok, {RestartStrategy, [Children]}}.

add(Sock) ->
	?debug("Sock = ~p",[Sock]),
	{ok, Pid} = supervisor:start_child(?MODULE, [Sock]),
	Pid.